clear
use "~/final_dataset.dta"
set matsize 11000

***TABLE A1
gen educ_xtab = P1_24_N
recode educ_xtab 5=4
label define educ_xtab 0."None" 1."Preschool" 2."Primary" 3."Middle School" 4."Middle School + tech"  6."High School" 7."Vocational + HS" 8."Undergrad" 9."Grad" 98."Don't know" 99."No response"
label values educ_xtab educ_xtab 
tab educ_xtab 

gen work_xtab = P2_9
label define work_xtab 1."Professional/technical" 2."Businessman" 3. "Admin" 4."Sales" 5."Informal commerce" 6."Army" 7. "Marines" 8."Police" 9."Fed Police" 10. "Bureaucrat" 11."Personal Services" 12."Agriculture" 13."Artesan" 14."Machinery" 15."Illegal commerce" 16."Other" 98."Don't know" 99."No response"
label values work_xtab work_xtab 
tab work_xtab 
***TABLE A2
eststo clear 
eststo: regress institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: regress  threat_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: regress institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id,  vce(cluster group_id) 
eststo: regress  threat_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id) 
eststo: regress institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 
eststo: regress  threat_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 

****TABLE A3
eststo clear 
set more off
eststo: logit institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: logit brute_force_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: logit  threat_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id) 
eststo: logit institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id) 
eststo: logit brute_force_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id,  vce(cluster group_id) 
eststo: logit  threat_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id) 
eststo: logit institutional_torture_dum  i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 
eststo: logit brute_force_dum i.allreform_with_fed  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 
eststo: logit  threat_dum i.allreform_with_fed   i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id) 

***TABLE A4

eststo clear
eststo: regress institutional_torture_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.Ent_arrest i.year_month, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest i.year_month, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest i.year_month, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.group_id, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.group_id, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.group_id, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.clave, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.clave, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_month i.clave, vce(cluster group_id)

****TABLE A8

levelsof Ent_arrest, local(levels) 
eststo clear
foreach i of local levels {
	eststo: regress institutional_torture_dum  i.allreform_with_fed i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id) 
}

eststo clear
levelsof Ent_arrest, local(levels) 
foreach i of local levels {
	eststo: regress brute_force_dum  i.allreform_with_fed i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id) 
}

levelsof Ent_arrest, local(levels) 
eststo clear
foreach i of local levels {
	eststo: regress threat_dum  i.allreform_with_fed i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id) 
}

****TABLE A9

levelsof Ent_arrest, local(states)
eststo clear 
foreach i of local states {
	eststo: regress brute_force_dum  i.allreform i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id)
}

levelsof Ent_arrest, local(states)
eststo clear 
foreach i of local states {
	eststo: regress institutional_torture_dum  i.allreform i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id)
}

levelsof Ent_arrest, local(states)
eststo clear 
foreach i of local states {
	eststo: regress threat_dum  i.allreform i.year_arrest i.clave if Ent_arrest != `i', vce(cluster group_id)
}

***FIGURE A1

generate factor_mn =0

replace factor_mn = 1 if leads_lags == "lead_12"
replace factor_mn = 2 if leads_lags == "lead_11"
replace factor_mn = 3 if leads_lags == "lead_10"
replace factor_mn = 4 if leads_lags == "lead_9"
replace factor_mn = 5 if leads_lags == "lead_8"
replace factor_mn = 6 if leads_lags == "lead_7"
replace factor_mn = 7 if leads_lags == "lead_6"
replace factor_mn = 8 if leads_lags == "lead_5"
replace factor_mn = 9 if leads_lags == "lead_4"
replace factor_mn = 10 if leads_lags == "lead_3"
replace factor_mn = 11 if leads_lags == "lead_2"
replace factor_mn = 12 if leads_lags == "lead_1"
replace factor_mn = 13 if leads_lags == "Implementation"
replace factor_mn = 14 if leads_lags == "lag_1"
replace factor_mn = 15 if leads_lags == "lag_2"
replace factor_mn = 16 if leads_lags == "lag_3"
replace factor_mn = 17 if leads_lags == "lag_4"
replace factor_mn = 18 if leads_lags == "lag_5"
replace factor_mn = 19 if leads_lags == "lag_6"
replace factor_mn = 20 if leads_lags == "lag_7"
replace factor_mn = 21 if leads_lags == "lag_8"
replace factor_mn = 22 if leads_lags == "lag_9"
replace factor_mn = 23 if leads_lags == "lag_10"
replace factor_mn = 24 if leads_lags == "lag_11"
replace factor_mn = 25 if leads_lags == "lag_12"


label define factor_mn 1."-12 months" 2."-11 months" 3."-10 months" 4."-9 months" 5."-8 months" 6."-7 months" 7."-6 months" 8."-5 months" 9."-4 months" 10."-3 months" 11."-2 months" 12."-1 month" 13."Reform" 14."+1 month" 15."+2 months" 16."+3 months" 17."+4 months" 18."+5 months" 19."+6 months" 20."+7 months" 21."+8 months" 22."+9 months" 23."+10 months" 24."+11 months" 25."+12 months" 
label values factor_mn factor_mn


****con coefs

set more off
regress institutional_torture_dum i.factor_mn i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.Mun_arrest i.year_month, vce(cluster group_id) 

#delimit;
coefplot, vertical  keep(1.factor_mn 2.factor_mn 3.factor_mn 4.factor_mn 5.factor_mn 6.factor_mn 7.factor_mn 8.factor_mn 9.factor_mn 10.factor_mn 11.factor_mn 12.factor_mn 13.factor_mn 14.factor_mn 15.factor_mn 16.factor_mn 17.factor_mn 18.factor_mn 19.factor_mn 20.factor_mn 21.factor_mn 22.factor_mn 23.factor_mn 24.factor_mn 25.factor_mn) recast(line) lwidth(.4) lcolor(black) ciopts(recast(rline) lpattern(shortdash_dot) color(black*.5%10))  xline(13) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) 
xlabel(, angle(vertical) labsize(small))  
xtitle(Torture, size(medium)) 
ylabel(, labsize(small)) 
name(lead_inst, replace)
;

***
set more off
regress brute_force_dum i.factor_mn i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Mun_arrest i.year_month, vce(cluster group_id) 

#delimit;
coefplot, vertical  keep(1.factor_mn 2.factor_mn 3.factor_mn 4.factor_mn 5.factor_mn 6.factor_mn 7.factor_mn 8.factor_mn 9.factor_mn 10.factor_mn 11.factor_mn 12.factor_mn 13.factor_mn 14.factor_mn 15.factor_mn 16.factor_mn 17.factor_mn 18.factor_mn 19.factor_mn 20.factor_mn 21.factor_mn 22.factor_mn 23.factor_mn 24.factor_mn 25.factor_mn) recast(line) lwidth(.4) lcolor(black) ciopts(recast(rline) lpattern(shortdash_dot) color(black*.5%10))  xline(13) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) 
xlabel(, angle(vertical) labsize(small))  
xtitle(Brure Force, size(medium)) 
ylabel(, labsize(small)) 
name(lead_brute, replace)
;
****

set more off
regress threat_dum i.factor_mn i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.Mun_arrest i.year_month, vce(cluster group_id) 

#delimit;
coefplot, vertical  keep(1.factor_mn 2.factor_mn 3.factor_mn 4.factor_mn 5.factor_mn 6.factor_mn 7.factor_mn 8.factor_mn 9.factor_mn 10.factor_mn 11.factor_mn 12.factor_mn 13.factor_mn 14.factor_mn 15.factor_mn 16.factor_mn 17.factor_mn 18.factor_mn 19.factor_mn 20.factor_mn 21.factor_mn 22.factor_mn 23.factor_mn 24.factor_mn 25.factor_mn) recast(line) lwidth(.4) lcolor(black) ciopts(recast(rline) lpattern(shortdash_dot) color(black*.5%10))  xline(13) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) 
xlabel(, angle(vertical) labsize(small))  
xtitle(Threats, size(medium)) 
ylabel(, labsize(small)) 
name(lead_threats, replace)
;

******
#delimit ;
graph combine  lead_inst lead_brute lead_threats, 
cols(3) rows(1)  commonscheme imargin(0 0 0 0) 
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
name(gcomm, replace)
ycommon
ysize(5) xsize(11)
;

****TABLE A10 - UNIT SPECIFIC TRENDS
***FULL SAMPLE

eststo clear 
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest, vce(cluster group_id)

eststo: regress institutional_torture_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest, vce(cluster group_id)

eststo: regress institutional_torture_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest, vce(cluster group_id)

***SUBSET FORMAL CONST REFORM BEGINS

eststo clear 
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2007, vce(cluster group_id)

eststo: regress institutional_torture_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.clave i.year_arrest i.group_id##c.year_arrest if year_arrest > 2007, vce(cluster group_id)

eststo: regress institutional_torture_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest if year_arrest > 2007, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.clave i.year_arrest i.clave##c.year_arrest if year_arrest > 2007, vce(cluster group_id)

***SUBSET EPN+

eststo clear 
eststo: regress brute_force_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2012, vce(cluster group_id)

eststo: regress brute_force_dum i.allreform_with_fed i.year_arrest i.group_id##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_arrest i.group_id##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_arrest i.group_id##c.year_arrest if year_arrest > 2012, vce(cluster group_id)

eststo: regress brute_force_dum i.allreform_with_fed i.year_arrest i.clave##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_arrest i.clave##c.year_arrest if year_arrest > 2012, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_arrest i.clave##c.year_arrest if year_arrest > 2012, vce(cluster group_id)

***FUILL SAMPLE - year-month trend
eststo clear 
eststo: regress brute_force_dum i.allreform_with_fed i.year_month i.Ent_arrest##c.year_month, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_month i.Ent_arrest##c.year_month, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_month i.Ent_arrest##c.year_month, vce(cluster group_id)

eststo: regress brute_force_dum i.allreform_with_fed i.year_month i.group_id##c.year_month , vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_month i.group_id##c.year_month , vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_month i.group_id##c.year_month , vce(cluster group_id)

eststo: regress brute_force_dum i.allreform_with_fed i.year_month i.clave##c.year_month , vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.year_month i.clave##c.year_month , vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.year_month i.clave##c.year_month, vce(cluster group_id)

***TABLE A11 - STATE x YEAR FE

eststo clear 
eststo: regress brute_force_dum i.allreform_with_fed i.Ent_arrest##i.year_arrest, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.Ent_arrest##i.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.Ent_arrest##i.year_arrest, vce(cluster group_id)

eststo: regress brute_force_dum i.allreform_with_fed i.clave i.Ent_arrest##i.year_arrest, vce(cluster group_id)
eststo: regress institutional_torture_dum i.allreform_with_fed i.clave i.Ent_arrest##i.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed i.clave i.Ent_arrest##i.year_arrest, vce(cluster group_id)

**TABLE A13
eststo: regress institutional_torture_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest i.Ent_arrest, vce(cluster group_id)
eststo: regress brute_force_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id)
eststo: regress threat_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.Ent_arrest, vce(cluster group_id)
eststo: regress institutional_torture_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id)
eststo: regress brute_force_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id)
eststo: regress threat_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.group_id, vce(cluster group_id)
eststo: regress institutional_torture_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id)
eststo: regress brute_force_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id)
eststo: regress threat_dum after_first_pub i.allreform SEXO i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.year_arrest i.clave, vce(cluster group_id)

**FIGURE A2
set more off
regress institutional_torture_dum i.allreform_with_fed##i.buroc_ter_log i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 
margins 0.allreform_with_fed#1.buroc_ter_log  0.allreform_with_fed#2.buroc_ter_log  0.allreform_with_fed#3.buroc_ter_log 1.allreform_with_fed#1.buroc_ter_log 1.allreform_with_fed#2.buroc_ter_log 1.allreform_with_fed#3.buroc_ter_log, atmeans post
estimate store buroc

regress institutional_torture_dum i.allreform_with_fed##i.cifra_negra_tercile i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 
margins 0.allreform_with_fed#1.cifra_negra_tercile 0.allreform_with_fed#2.cifra_negra_tercile 0.allreform_with_fed#3.cifra_negra_tercile 1.allreform_with_fed#1.cifra_negra_tercile   1.allreform_with_fed#2.cifra_negra_tercile  1.allreform_with_fed#3.cifra_negra_tercile, atmeans post
estimate store cifra


#delimit ;
coefplot (buroc, label(Model 1) msize(small) mlabcolor(black) mcolor(maroon) msymbol(square)  mlabsize(small)) //
(cifra, label(Model 2) msize(small) mlabcolor(black) mcolor(maroon) msymbol(circle) mlabsize(small)), vertical drop(0.homicide) byopts(xrescale)
headings(0.allreform_with_fed#1.buroc_ter_log ="{bf:State capacity}" 0.allreform_with_fed#1.cifra_negra_tercile  = "{bf:Impunity}", angle(vertical) labcolor(black) labsize(small))
coeflabels (0.allreform_with_fed#1.buroc_ter_log ="0.Reform X Low" 0.allreform_with_fed#2.buroc_ter_log ="0. Reform X Middle" 0.allreform_with_fed#3.buroc_ter_log= "0.Reform x High" 1.allreform_with_fed#1.buroc_ter_log  ="1. Reform x Low" 1.allreform_with_fed#2.buroc_ter_log ="1. Reform X Middle" 1.allreform_with_fed#3.buroc_ter_log= "1. Reform X High)" //
0.allreform_with_fed#1.cifra_negra_tercile ="0.Reform X Low" 0.allreform_with_fed#2.cifra_negra_tercile ="0. Reform X Middle" 0.allreform_with_fed#3.cifra_negra_tercile= "0.Reform x High" 1.allreform_with_fed#1.cifra_negra_tercile  ="1.Reform X Low" 1.allreform_with_fed#2.cifra_negra_tercile ="0.Reform X Middle"  1.allreform_with_fed#3.cifra_negra_tercile= "1.Reform x High" , labsize(tiny))
ylabel(, labsize(vsmall))
xlabel(, angle(vertical) labsize(vsmall) glcolor(black))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(dkgreen) mcolor(maroon) mlabsize(tiny)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
plotregion(fcolor(white) ifcolor(none))
name(torturejo, replace)
ysize(5) xsize(8)
;
#delimit cr

***TABLES A14

eststo clear
eststo: regress institutional_torture_dum i.allreform_with_fed##i.buroc_ter_log i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 
eststo: regress institutional_torture_dum i.allreform_with_fed##i.cifra_negra_tercile i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 

***TABLES A15

eststo clear
eststo: regress brute_force_dum i.allreform_with_fed##i.buroc_ter_log i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed##i.cifra_negra_tercile i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 

***TABLES A16

eststo clear
eststo: regress threat_dum i.allreform_with_fed##i.buroc_ter_log i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 
eststo: regress threat_dum i.allreform_with_fed##i.cifra_negra_tercile i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest, vce(cluster group_id) 

***TABLE A17
eststo clear
eststo: regress brute_force_dum i.allreform_with_fed##i.kernel_war  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed##c.hom_totpc  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed##i.crimes1 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo: regress brute_force_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id)

***TABLE A18
eststo clear
eststo: regress threat_dum i.allreform_with_fed##i.kernel_war  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo:  regress threat_dum i.allreform_with_fed##c.hom_totpc  i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo:  regress threat_dum i.allreform_with_fed##i.crimes1 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo:  regress threat_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id)

***TABLE A19
gen Authority2 = P3_2

recode Authority2  5=5 6=5 1=1 2=2 3=3 4=4 7=0 8=0 98=. 99=.

label define Authority2 0."Other" 1."Municipal Police" 2."State Police" 3."Federal Police" 4."Judicial Police" 5."Army or Navy" 
label values Authority2 Authority2
gen municipal = Authority2
recode municipal 1=1 *=0

gen state =Authority2
recode state 2=1 *=0

gen ministerial = Authority2
recode ministerial 4=1 *=0

gen federal =Authority2
recode federal 3=1 *=0
gen army = Authority2
recode army = 5


generate fac =.
replace fac = 0 if prior_lead19 == 1 
replace fac = 1 if lead_18 == 1 
replace fac = 2 if lead_17 == 1 
replace fac = 3 if lead_16 ==1
replace fac = 4 if lead_15 ==1
replace fac = 5 if lead_14 ==1
replace fac = 6 if lead_13 ==1
replace fac = 7 if lead_12 ==1
replace fac = 8 if lead_11 ==1
replace fac = 9 if lead_10 ==1
replace fac = 10 if lead_9 ==1
replace fac = 11 if lead_8 ==1
replace fac = 12 if lead_7 ==1
replace fac = 13 if lead_6 ==1
replace fac = 14 if lead_5 ==1
replace fac = 15 if lead_4 ==1
replace fac = 16 if lead_3 ==1
replace fac = 17 if lead_2 ==1
replace fac = 18 if lead_1 ==1
replace fac = 19 if  leads_lags == "Implementation"
replace fac = 20 if  lag_1 ==1
replace fac = 21 if  lag_2 ==1
replace fac = 22 if  lag_3 ==1
replace fac = 23 if  lag_4 ==1
replace fac = 24 if  lag_5 ==1
replace fac = 25 if  lag_6 ==1
replace fac = 26 if  lag_7 ==1
replace fac = 27 if  lag_8 ==1
replace fac = 28 if  lag_9 ==1
replace fac = 29 if  lag_10 ==1
replace fac = 30 if  lag_11==1
replace fac = 31 if  lag_12==1
replace fac = 32 if  lag_13==1
replace fac = 33 if  lag_14==1
replace fac = 34 if  lag_15==1
replace fac = 35 if  lag_16==1
replace fac = 36 if  lag_17==1
replace fac = 37 if lag_18==1
replace fac = 38 if post_lag19 == 1 

label define nuevofac 0."Prior" 1."-18m" 2."-17m" 3."-16m" 4."-15m"  5."-14m" 6."-13m" 7."-12m" 8."-11m" 9."-10m" 10."-9m" 11."-8m" 12."-7m" 13."-6m" 14."-5m" 15."-4m" 16."-3m" 17."-2m" 18."-1m" 19."Reform" 20."+1m" 21."+2m" 22."+3m" 23."+4m" 24."+5m" 25."+6m" 26."+7m" 27."+8m" 28."+9m" 29."+10m" 30."+11m" 31."+12m" 32."+13m" 33."+14m" 34."+15m" 35."+16m" 36."+17m" 37."+18m" 38."Post 18m" 

label values fac nuevofac
eststo clear
eststo: regress theft i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress homicide i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress kidnap i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress illegal_weapons i.fac i.clave i.year_month, vce(cluster group_id) 

***TABLE A20
eststo clear
eststo: regress municipal i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress state i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress ministerial i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress federal i.fac i.clave i.year_month, vce(cluster group_id) 
eststo: regress army i.fac i.clave i.year_month, vce(cluster group_id) 

***TABLE A22 - unit trends joint operations
eststo clear 
eststo: regress brute_force_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest < 2013, vce(cluster clave)
eststo: regress institutional_torture_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest < 2013, vce(cluster clave)
eststo: regress threat_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest < 2013, vce(cluster clave)

eststo: regress brute_force_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest < 2013, vce(cluster clave)
eststo: regress institutional_torture_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest < 2013, vce(cluster clave)
eststo: regress threat_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest < 2013, vce(cluster clave)
**repeat: 2001-2012
eststo clear
eststo: regress brute_force_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)
eststo: regress institutional_torture_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)
eststo: regress threat_dum i.d_operacion_conjunta_all i.year_arrest i.Ent_arrest##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)

eststo: regress brute_force_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)
eststo: regress institutional_torture_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)
eststo: regress threat_dum i.d_operacion_conjunta_all i.year_arrest i.clave##c.year_arrest if year_arrest > 2000 &  year_arrest < 2013, vce(cluster clave)

***TABLE A23
eststo clear 
set more off

eststo: regress brute_force_dum d_operacion_conjunta_all i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: regress brute_force_dum d_operacion_conjunta_all kernel_war i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest i.clave if year_arrest<2013, vce(cluster clave) 
eststo: regress brute_force_dum d_operacion_conjunta_all##i.federal_prison i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.clave  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: regress brute_force_dum d_operacion_conjunta_all##authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 


***TABLE A24

eststo clear 
set more off

eststo: regress threat_dum d_operacion_conjunta_all i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: regress threat_dum d_operacion_conjunta_all kernel_war i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.year_arrest i.clave if year_arrest<2013, vce(cluster clave) 
eststo: regress threat_dum d_operacion_conjunta_all##i.federal_prison i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.clave  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: regress threat_dum d_operacion_conjunta_all##authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 

****FIGURE A9
set more off
regress institutional_torture_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
margins i.authority2, dydx(i.d_operacion_conjunta_all) post
***********************************
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(small))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Joint Oper. & Torture, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(jotor, replace)
ysize(4) xsize(5)
;
#delimit cr


set more off
regress brute_force_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
margins i.authority2, dydx(i.d_operacion_conjunta_all) post
***********************************
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(small))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Joint Oper. & Brute Force, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(jobrute, replace)
ysize(4) xsize(5)
;
#delimit cr

set more off
regress threat_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
margins i.authority2, dydx(i.d_operacion_conjunta_all) post
***********************************
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(small))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Joint Oper. & Threats, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(jothreat, replace)
ysize(4) xsize(5)
;
#delimit cr



set more off
regress institutional_torture_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
margins i.authority2, dydx(i.allreform_with_fed) post
***********************************
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(small))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Reform & Torture, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(reftor, replace)
ysize(4) xsize(5)
;
#delimit cr


*******Brute
set more off
regress brute_force_dum i.allreform_with_fed##authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id) 
eststo mar1: margins i.authority2, dydx(allreform_with_fed) post
**********
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(tiny))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Reform & Brute Force, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(refbrute, replace)
ysize(4) xsize(5)
;
#delimit cr

*******threats

set more off
regress threat_dum i.allreform_with_fed##authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest , vce(cluster group_id) 
eststo mar1: margins i.authority2, dydx(allreform_with_fed) post
#delimit ;
coefplot, keep(1.authority2 2.authority2 3.authority2 4.authority2 5.authority2)
coeflabels(, labcolor(black) labsize(small))
xlabel( , labsize(tiny))
mlabel format(%3.2f) mlabposition(12) msize(small) mlabcolor(navy) mcolor(maroon) mlabsize(small)
ciopts(lcolor(black))
graphregion(fcolor(white) lcolor(none) ifcolor(none) ilcolor(none))
ti(Reform & Threats, style(small))
xline(0)
xlabel(-0.30(0.1)0.10, labsize(vsmall) glcolor(black))
plotregion(fcolor(white) ifcolor(none))
name(refthreat, replace)
ysize(4) xsize(5)
;
#delimit cr



#delimit ;
graph combine jotor jobrute jothreat reftor refbrute refthreat, 
cols(3) rows(2)  commonscheme imargin(0 0 0 0) 
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
name(gcomm, replace)
ycommon
ysize(5) xsize(8)
;

*****MODELS FOR SECTIONS 7.1-7.3 

eststo clear
eststo: regress institutional_torture_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id)
eststo: regress brute_force_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id)
eststo: regress threat_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest, vce(cluster group_id)

eststo clear
regress institutional_torture_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: margins i.authority2, dydx(d_operacion_conjunta_all) post
regress brute_force_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: margins i.authority2, dydx(d_operacion_conjunta_all) post
regress threat_dum i.d_operacion_conjunta_all##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous  i.Ent_arrest  i.year_arrest if year_arrest<2013, vce(cluster clave) 
eststo: margins i.authority2, dydx(d_operacion_conjunta_all) post

regress institutional_torture_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest , vce(cluster group_id) 
eststo: margins i.authority2, dydx(allreform_with_fed) post
regress brute_force_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest , vce(cluster group_id) 
eststo: margins i.authority2, dydx(allreform_with_fed) post
regress threat_dum i.allreform_with_fed##i.authority2 i.Sex i.occupation i.cat_age i.education i.wealth_cat4 i.noread_write i.indigenous i.group_id i.year_arrest , vce(cluster group_id) 
eststo: margins i.authority2, dydx(i.allreform_with_fed) post




